#!/bin/bash

read -p "input imageName:" filename
if [ -z "$filename" ];then
  echo "please input filename"
elif [ ! -f "$filename" ];then
  echo "$filename is not exit"
else
  dirname="icon_img"
  name_array=("icon-58.png" "icon-114.png" "icon-80.png" "icon-120.png" "icon-180.png")
  size_array=("58" "80" "114" "120" "180")
  mkdir $dirname
  for((i=0;i<${#name_array[@]};i++));do
    m_dir=$dirname/${name_array[i]}
    cp $filename $m_dir
    sips -Z ${size_array[i]} $m_dir
  done
fi
